<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Drawio私有云-登录</title>
    <meta name="author" content="DeathGhost"/>
    <script src="config.js"></script>

    <link rel="stylesheet" type="text/css" href="css/style.css" tppabs="css/style.css"/>
    <style>
        body {
            height: 100%;
            background: #16a085;
            overflow: hidden;
        }

        canvas {
            z-index: -1;
            position: absolute;
        }
    </style>
    <script src="js/jquery.min.js"></script>
    <script src="layer/layer.js"></script>
    <script src="js/verificationNumbers.js" tppabs="js/verificationNumbers.js"></script>
    <script src="js/Particleground.js" tppabs="js/Particleground.js"></script>
    <script>
        $(document).ready(function () {
            //粒子背景特效
            $('body').particleground({
                dotColor: '#5cbdaa',
                lineColor: '#5cbdaa'
            });
            $("#serverUrl").html("服务器:" + baseUrl)
            //测试提交，对接程序删除即可
            $(".submit_btn").click(function () {
                let username = $("#username").val()
                let password = $("#password").val()
                if (username && password && username.length > 0 && password.length > 0) {
                    let rep = $.ajax({
                        url: baseUrl + "/login",
                        data: {username: username, password: password},
                        async: false
                    });
                    rep = rep.responseJSON
                    if (rep.code && rep.code === 200) {
                        localStorage.setItem('token', rep.token)
                        window.location.href = window.location.href.replace('login.html', 'drawio.html')
                    } else {
                        layer.msg('' + rep.msg);
                    }
                    console.log('login', rep)
                } else {
                    layer.msg("请输入用户名或密码")
                }


            });
        });
    </script>
</head>
<body>
<dl class="admin_login">
    <dt>
        <strong style="color:white">Drawio 私有云</strong>
        <em>Drawio private</em>
    </dt>
    <dd class="user_icon">
        <input type="text" id="username" placeholder="账号" class="login_txtbx"/>
    </dd>
    <dd class="pwd_icon">
        <input type="password" id="password" placeholder="密码" class="login_txtbx"/>
    </dd>

    <dd>
        <input type="button" value="立即登陆" class="submit_btn"/>
    </dd>
    <dd>
        <p>© 2021 copyright drawio-minio-oss</p>
        <p>https://github.com/mathcoder23/drawio-minio-oss</p>
    </dd>
    <dd>
        <p id="serverUrl">

        </p>
    </dd>
</dl>
</body>
</html>

